<?php



namespace App\Model;

use App\Helpers\Helper;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

/**
 * 动态评论
 */
class MomentComment extends Model
{
    protected $table = 'moment_comment';

    //正常
    const STATUS_OK = 1;
    //删除
    const STATUS_DEL = 0;

    protected $fillable = [
        "user_id", "moment_id", "content", "commented_id", "parent_comment_id", "commented_user_id", "flag", "top"
    ];

    public function userProfile()
    {
        return $this->belongsTo(UserProfile::class, 'user_id', 'user_id');
    }

    public function moment()
    {
        return $this->belongsTo(Moment::class, 'moment_id', 'id');
    }

    /**
     * 关联评论
     */
    function commented()
    {
        return $this->belongsTo(MomentComment::class, 'commented_id', 'id');
    }
}
